package com.kb.design.controller;

import com.kb.design.common.ApiResponse;
import com.kb.design.entity.DesignDaily;
import com.kb.design.service.DailyService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;;

@RestController
@RequestMapping("daily")
public class DailyController {

    @Resource
    private DailyService dailyService;


    /**
     * 提交日报
     * @param daily
     * @return
     */
    @PostMapping("/addDaily")
    public ApiResponse addDaily(@RequestBody DesignDaily daily) {
        dailyService.dailyAdd(daily);
        return ApiResponse.success("成功");
    }

    /**
     * 获取最新日报列表
     * @param daily
     * @return
     */
    @PostMapping("/queryLatestList")
    public ApiResponse queryLatestList(@RequestBody DesignDaily daily) {
        return ApiResponse.success(dailyService.queryLatestList(daily));
    }
    /**
     * 获取日报详细
     * @param daily
     * @return
     */
    @PostMapping("/selectDailyInfo")
    public ApiResponse selectDailyInfo(@RequestBody DesignDaily daily) {
        return ApiResponse.success(dailyService.selectDailyInfo(daily));
    }

    /**
     * 获取提示信息
     * @param daily
     * @return
     */
    @PostMapping("/getPromptInfo")
    public ApiResponse getPromptInfo(@RequestBody DesignDaily daily) {
        return ApiResponse.success(dailyService.getPromptInfo(daily));
    }
    /**
     * 获取部门未提交日报人数
     * @param daily
     * @return
     */
    @PostMapping("/getNoDailyCount")
    public ApiResponse getNoDailyCount(@RequestBody DesignDaily daily) {
        return ApiResponse.success(dailyService.getNoDailyCount(daily));
    }
    /**
     * 今天空闲人列表
     * @param daily
     * @return
     */
    @PostMapping("/queryTodyFreeList")
    public ApiResponse queryTodyFreeList(@RequestBody DesignDaily daily) {
        return ApiResponse.success(dailyService.queryTodyFreeList(daily));
    }
}
